package com.zlk.algorithm.algorithm.greedy;

import java.util.Arrays;
import java.util.Stack;

/**
 * @program: algorithm
 * @ClassName LowestLexicography
 * @description:给定一个由字符串组成的数组strs，必须把所有的字符串拼接起来，返回所有可能的拼接结果中字典序最小的结果
 * @author: slfang
 * @create: 2024-02-26 20:25
 * @Version 1.0
 **/
public class LowestLexicography {

    public String lowestString2(String[]  strs){
        Arrays.sort(strs,(a,b)->{return (a+b).compareTo(b+a) ;} );
        String res = "";
        for (String str : strs) {
            res += str;
        }
        return res;
    }


    //方法2回溯 todo



}
